home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 …ember: Reference Library / Dev.CD Dec 00 RL Disk 1.toast / pc / technical documentation / develop / additional articles / developing symbiotic apps / symbiotic samples / symbiotic client source / javelin.cw_mw9 / symbiont.h < prev    next >
Encoding:
Text File  |  1996-04-13  |  6.8 KB  |  169 lines

  1. //    Symbiont.h
  2. //
  3. // Scott Mulligan
  4. //
  5. //    Copyright © 1996 Apple Computer, Inc.
  6. //    All rights reserved.
  7.  
  8. #define HEARTBEAT_SEND          30*60            // How often to send a heartbeat
  9. #define HEARTBEAT_CHECK          30*60            // How often to check to see if we got one
  10. #define MAX_MISSED_HEARTBEATS     3            // How many missed heartbeats is too many
  11.  
  12. #define kSymbioticStrings      1000            // Rsrc ID of STR#
  13.  
  14. #define    ePPCError                  1            // String indices
  15. #define    eOurMachine                  2
  16. #define eVersion                    3
  17. #define eAESend                      4
  18.  
  19. #define TRUE    1
  20. #define FALSE    0
  21.  
  22. /*    These #defines correspond to values in the Pascal source code.
  23.     TESample.c and TESample.r include this file. */
  24.  
  25. /*    Determining an application's minimum size to request from MultiFinder depends
  26.     on many things, each of which can be unique to an application's function,
  27.     the anticipated environment, the developer's attitude of what constitutes
  28.     reasonable functionality and performance, etc. Here is a list of some things to
  29.     consider when determining the minimum size (and preferred size) for your
  30.     application. The list is pretty much in order of importance, but by no means
  31.     complete.
  32.     
  33.     1.    What is the minimum size needed to give almost 100 percent assurance
  34.         that the application won't crash because it ran out of memory? This
  35.         includes not only things that you do have direct control over such as
  36.         checking for NIL handles and pointers, but also things that some
  37.         feel are not so much under their control such as QuickDraw and the
  38.         Segment Loader.
  39.         
  40.     2.    What kind of performance can a user expect from the application when
  41.         it is running in the minimum memory configuration? Performance includes
  42.         not only speed in handling data, but also things like how many documents
  43.         can be opened, etc.
  44.         
  45.     3.    What are the typical sizes of scraps is [a boy dog] that a user might
  46.         wish to work with when lauching or switching to your application? If
  47.         the amount of memory is too small, the scrap may get lost [will have
  48.         to be shot]. This can be quite frustrating to the user.
  49.         
  50.     4.    The previous items have concentrated on topics that tend to cause an
  51.         increase in the minimum size to request from MultiFinder. On the flip
  52.         side, however, should be the consideration of what environments the
  53.         application may be running in. There may be a high probability that
  54.         many users with relatively small memory configurations will want to
  55.         avail themselves of your application. Or, many users might want to use it
  56.         while several other, possibly related/complementary applications are
  57.         running. If that is the case, it would be helpful to have a fairly
  58.         small minimum size.
  59.     
  60.     What we did for TESample:
  61.     
  62.         We determined the smallest heap size that TESample could have and still
  63.         run (22K). For the preferred size we added enough space to permit:
  64.             a. a maximum size TextEdit text handle (32000 characters)
  65.             b. a maximum usable TextEdit scrap (32000 characters)
  66.             b. a maximum scrap as a result of Copy (32000 characters)
  67.             d. a little performance cushion (see 2, above) (10K)
  68.         Result: 122K for preferred size
  69.         
  70.         For the minimum size we took the 22K and then scaled down our requirements
  71.         for a,b, and c above. We thought that providing 16K more would be lean
  72.         and mean (see 4, above).
  73.         Result: 38K for minimum size
  74. */
  75.  
  76. #define kPrefSize                122
  77. #define kMinSize                38
  78.     
  79. /* The following constants are used to identify menus and their items. The menu IDs
  80.    have an "m" prefix and the item numbers within each menu have an "i" prefix. */
  81. #define    mApple                    128        /* Apple menu */
  82. #define    iAbout                    1
  83.  
  84. #define    mFile                    129        /* File menu */
  85. #define    iNew                    1
  86. #define    iQuit                    2
  87.  
  88. #define    mEdit                    130        /* Edit menu */
  89. #define    iUndo                    1
  90. #define    iCut                    3
  91. #define    iCopy                    4
  92. #define    iPaste                    5
  93. #define    iClear                    6
  94.  
  95. /*    1.01 - kTopLeft - This is for positioning the Disk Initialization dialogs. */
  96.  
  97. #define kDITop                    0x0050
  98. #define kDILeft                    0x0070
  99.  
  100. /* kMaxOpenDocuments is used to determine whether a new document can be opened
  101.    or created. We keep track of the number of open documents, and disable the
  102.    menu items that create a new document when the maximum is reached. If the
  103.    number of documents falls below the maximum, the items are enabled again. */
  104. #define    kMaxOpenDocuments        1
  105.     
  106. /*    kMaxDocWidth is an arbitrary number used to specify the width of the TERec's
  107.     destination rectangle so that word wrap and horizontal scrolling can be
  108.     demonstrated. */
  109. #define    kMaxDocWidth            576
  110.     
  111. /* kSysEnvironsVersion is passed to SysEnvirons to tell it which version of the
  112.    SysEnvRec we understand. */
  113. #define    kSysEnvironsVersion        1
  114.  
  115. /* kOSEvent is the event number of the suspend/resume and mouse-moved events sent
  116.    by MultiFinder. Once we determine that an event is an OSEvent, we look at the
  117.    high byte of the message sent to determine which kind it is. To differentiate
  118.    suspend and resume events we check the resumeMask bit. */
  119. #define    kOSEvent                app4Evt    /* event used by MultiFinder */
  120. #define    kSuspendResumeMessage    1        /* high byte of suspend/resume event message */
  121. #define    kResumeMask                1        /* bit of message field for resume vs. suspend */
  122. #define    kMouseMovedMessage        0xFA    /* high byte of mouse-moved event message */
  123. #define    kNoEvents                0        /* no events mask */
  124.  
  125. /* 1.01 - kMinHeap - This is the minimum result from the following
  126.      equation:
  127.             
  128.             ORD(GetApplLimit) - ORD(ApplicZone)
  129.             
  130.      for the application to run. It will insure that enough memory will
  131.      be around for reasonable-sized scraps, FKEYs, etc. to exist with the
  132.      application, and still give the application some 'breathing room'.
  133.      To derive this number, we ran under a MultiFinder partition that was
  134.      our requested minimum size, as given in the 'SIZE' resource. */
  135.      
  136. #define    kMinHeap                 (29 * 1024)
  137.     
  138. /* 1.01 - kMinSpace - This is the minimum result from PurgeSpace, when called
  139.      at initialization time, for the application to run. This number acts
  140.      as a double-check to insure that there really is enough memory for the
  141.      application to run, including what has been taken up already by
  142.      pre-loaded resources, the scrap, code, and other sundry memory blocks. */
  143.      
  144. #define    kMinSpace                (20 * 1024)
  145.  
  146. /*    kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
  147. #define kExtremeNeg                -32768
  148. #define kExtremePos                (32767 - 1)    /* required to address an old region bug */
  149.     
  150. /* kTESlop provides some extra security when pre-flighting edit commands. */
  151. #define    kTESlop                    1024
  152.  
  153. /* The following are indicies into STR# resources. */
  154. #define    eWrongMachine            1
  155. #define    eSmallSize                2
  156. #define    eNoMemory                3
  157. #define    eNoSpaceCut                4
  158. #define    eNoCut                    5
  159. #define    eNoCopy                    6
  160. #define    eExceedPaste            7
  161. #define    eNoSpacePaste            8
  162. #define    eNoWindow                9
  163. #define    eExceedChar                10
  164. #define    eNoPaste                11
  165.  
  166. #define    rMenuBar     128                /* application's menu bar */
  167. #define    rUserAlert    1000                /* user error alert */
  168. #define    kErrStrings     128                /* error string list */
  169.